FROM openjdk:8-jdk-alpine

RUN set -ex && \
    apk add ttf-dejavu git ca-certificates && \
    apk add --virtual .fetch-deps curl tar && \
    [ ! -e /etc/nsswitch.conf ] && echo ‘hosts: files dns‘ > /etc/nsswitch.conf

RUN apk add python3 && pip3 install --upgrade pip && pip3 install docker-compose

# http://mirrors.jenkins-ci.org
RUN curl -fL -o jenkins.war http://mirrors.jenkins-ci.org/war/2.316/jenkins.war

ADD dockerd-entrypoint.sh /usr/local/bin
RUN chmod 777 /usr/local/bin/dockerd-entrypoint.sh && apk del .fetch-deps

VOLUME ["/var/jenkins_home"]
EXPOSE 8080
ENV JENKINS_HOME     /var/jenkins_home
ENV PATH             ${PATH}:${JAVA_HOME}/bin
ENV TZ Asia/Shanghai
CMD ["dockerd-entrypoint.sh","java","-jar","jenkins.war","--prefix=/jenkins"]